#include "AutoFocusInterface.h"


namespace Qly
{

AutoFocusInterface::AutoFocusInterface(QObject *parent)
    : QObject{parent}
{}

void AutoFocusInterface::attach(FocusMeasureObject *focus, StageControl *control, IndustryCamera *camera)
{
    assert(focus);
    m_pFocusObject = focus;
    connect(m_pFocusObject, &FocusMeasureObject::focusMeasure, this, &AutoFocusInterface::newFocusValue);

    assert(control);
    m_pStageControl = control;
    connect(m_pStageControl, &StageControl::zMoveFinish, this, &AutoFocusInterface::zMoveFinished);

    assert(camera);
    m_pCamera = camera;
}


void AutoFocusInterface::setRange(double lower_mm, double higher_mm, double speed_mmps)
{
    m_low_mm = lower_mm;
    m_high_mm = higher_mm;
    m_speed_mmps = speed_mmps;
}

}
